<template>
	<full-page-layout :safety="false">
		<view class="start-page">
			<u-loading-icon size="80" color="#333"></u-loading-icon>
		</view>
	</full-page-layout>
</template>

<script>
import FullPageLayout from '@/components/FullPageLayout.vue'

let timeOutTask = null;

export default {
	name:'startPage',
	components:{FullPageLayout},
	onReady(){
		let token = this.$store.getters['user/getToken'];
		let gopage = this.$config.path.login
		if (token) {
			gopage = this.$config.path.home
		}
		timeOutTask = setTimeout(()=>{
			uni.navigateTo({url:gopage})
		},5*1000)
	},
	onUnload(){
		try{
			clearTimeout(timeOutTask)
		}catch(e){
			//TODO handle the exception
		}
	}
}
</script>

<style scoped lang="scss">
.start-page{
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: $uni-bg-color-mask;
}
</style>
